package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.api.domain.UserInvitationIncomeDetails;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author xuanqicheng
 */
@Repository
public class UserInvitationIncomeDetailsDao {

    @Autowired
    private SqlSession sqlSession;

    public void insert(UserInvitationIncomeDetails obj){
        sqlSession.insert("insertUserInvitationIncomeDetails",obj);
    }

    /**
     * 查询列表
     * @param inviteUserId
     * @param startNum
     * @param pageSize
     * @param detailType
     */
    public List<UserInvitationIncomeDetails>  selectUserInvitationIncomPage(long inviteUserId,
                                                                            int startNum, int pageSize,
                                                                            int detailType) {
        Map<String,Object> params = new HashMap<>(3);
        params.put("inviteUserId",inviteUserId);
        params.put("startNum",startNum);
        params.put("pageSize",pageSize);
        params.put("detailType",detailType);
        return sqlSession.selectList("selectUserInvitationIncomPage",params);
    }

    public UserInvitationIncomeDetails selectUserInvitationIncom(long inviteUserId){
        return sqlSession.selectOne("selectUserInvitationIncom",inviteUserId);
    }
}
